﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Com.CMS263.PO;
using Com.CMS263.BLL;
using Com.CMS263.Util;

namespace Com.CMS263.Web.manage.MarryInfo
{
    public partial class Marry_action : System.Web.UI.Page
    {
        MarryShow ms = new MarryShow();
        MarryShowBLL msBll = new MarryShowBLL();
        MarryImage mi = new MarryImage();
        MarryImageBLL miBll = new MarryImageBLL();
        protected void Page_Load(object sender, EventArgs e)
        {
            string op = Request["op"];
            if (op == "deleteMarry")
            {
                int id = int.Parse(Request["id"]);

                if (deleteMarry(id))
                {
                    Response.Write("ok");
                }
                else
                {
                    Response.Write("no");
                }
            }
            else if (op=="deleteMarryImage")
            {
                int id = int.Parse(Request["id"]);

                if (deleteMarryImage(id))
                {
                    Response.Write("ok");
                }
                else
                {
                    Response.Write("no");
                }
            }
        }
        public bool deleteMarry(int id)
        {
            msBll.entity = (MarryShow)msBll.FindModelById("MarryShow", id);
            if (msBll.Delete())
            {
                return true;
            }
            else
            {
                return false;
            }           
        }
        public bool deleteMarryImage(int id)
        {
            miBll.entity = (MarryImage)miBll.FindModelById("MarryImage", id);
            if (miBll.Delete())
            {
                return true;
            }
            else
            {
                return false;
            }     
        }
    }
}
